package com.boot.mall.coupon.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot.common.utils.PageUtils;
import com.boot.common.utils.Query;

import com.boot.mall.coupon.dao.SeckillPromotionDao;
import com.boot.mall.coupon.entity.SeckillPromotionEntity;
import com.boot.mall.coupon.service.SeckillPromotionService;


@Service("seckillPromotionService")
public class SeckillPromotionServiceImpl extends ServiceImpl<SeckillPromotionDao, SeckillPromotionEntity> implements SeckillPromotionService {


    @Override
    public PageUtils pageList(Map<String, Object> params) {
        // 获取参数
        String curr = (String) params.get("page");
        long current = 1;
        if (curr != null) {
            current = Integer.parseInt(curr);
        }
        long limit = 1;
        String limitStr = (String) params.get("limit");
        if (limitStr != null) {
            limit = Integer.parseInt(limitStr);
        }
        Page<SeckillPromotionEntity> page = new Page<>(current, limit);
        baseMapper.selectPage(page,null);
        PageUtils pageUtils = new PageUtils(page.getRecords(),(int)page.getTotal(),(int)limit,(int)current);
        return pageUtils;
    }
}